package com.mlyol.factory.simple;

public class PizzFactory {

    Pizz order(Class<? extends Pizz> pizzClass) {
        Pizz ret = null;
        if (pizzClass == GreekPizz.class) {
            ret = new GreekPizz();
        } else if (pizzClass == CheesePizz.class) {
            ret = new CheesePizz();
        }
        if (ret != null) {
            ret.prepare();
            ret.bake();
            ret.box();
            ret.cut();
        }
        return ret;
    }

    public static void main(String[] args) {

        PizzFactory pizzFactory = new PizzFactory();
        Pizz order = pizzFactory.order(CheesePizz.class);
        order.prepare();

    }

}
